package com.guoxin.chapter7.fromatok2;

import java.text.SimpleDateFormat;

public class DateTools {
	private static ThreadLocal<SimpleDateFormat> ts = new ThreadLocal<>();
	
	public static SimpleDateFormat getSimpleDateFormat(String datePattern){
		SimpleDateFormat sdf = null;
		sdf = ts.get();
		if(sdf==null){
			sdf = new SimpleDateFormat(datePattern);
			ts.set(sdf);
		}
		return sdf;
	}
}
